package com.atguigu.java8.stream;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

/**
 * @author zhangcheng
 * @date 2024/6/14 10:17
 * @description
 */
public class TestDuration {

    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime lastActivityTime = LocalDateTime.parse("2024-06-14 10:45:00", dateTimeFormatter);
        long seconds = Duration.between(lastActivityTime, now).getSeconds();
        System.out.println(seconds);
        System.out.println(seconds > 30 *60);
    }
}
